﻿namespace Pap.Web.Modules.Reports.ViewModel
{
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Linq;

    using Pap.Data;
    using Pap.Web.Utils;

    /// <summary>
    /// 
    /// </summary>
    public class WaitingListReportViewModel : IViewModel
    {
        #region [ Fields ]

        /// <summary>
        /// 
        /// </summary>
        IReportRepository _ReportRepository;

        #endregion Fields

        #region [ Constructors ]

        /// <summary>
        /// Initializes a new instance of the <see cref="WaitingListReportViewModel"/> class.
        /// </summary>
        /// <param name="repo">The repo.</param>
        public WaitingListReportViewModel(IReportRepository repo)
        {
            _ReportRepository = repo;
        }

        #endregion Constructors

        #region [ Methods ]

        /// <summary>
        /// Gets all committee.
        /// </summary>
        /// <returns></returns>
        public IEnumerable<ICommittee> GetAllCommittee()
        {
            return _ReportRepository.FindCommittee(committee => true);
        }

        /// <summary>
        /// Gets all projects.
        /// </summary>
        /// <returns></returns>
        public IEnumerable<IProject> GetAllProjects()
        {
            return _ReportRepository.FindProjects(project => true);
        }

        /// <summary>
        /// Gets the waiting list.
        /// </summary>
        /// <param name="projects">The projects.</param>
        /// <param name="committees">The committees.</param>
        /// <returns></returns>
        public IEnumerable<IVWaitingListReport> GetWaitingList(List<string> projects, List<string> committees)
        {
            return _ReportRepository.FindWaitingListReport(u => projects.Contains(u.ProjectID.ToString()) && committees.Contains(u.CommitteeID.ToString())).ToList();   
        }

        #endregion Methods
    }
}